package
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.utils.setInterval;
	import flash.utils.setTimeout;
	import iscript.gameFramework.GameLite.events.GameContentEvent;
	import iscript.gameFramework.GameLite.Game;
	
	public class applicationDomain extends Sprite
	{
		
		public function applicationDomain()
		{
			var game:Game = new Game(stage);
			
			Game.Content.addSwf("domain/A.swf")
			Game.Content.addGameContentListener("domain/A.swf", showElement)
			Game.Content.addGameContentListener("domain/B.swf", showElement)
		}
		
		private var a:Boolean
		private var target:MovieClip
		
		private function showElement(e:GameContentEvent):void
		{
			
			target = Game.Content.getMovieClipByClass("Show.FlashA")
			
			if (this.numChildren > 0)
			{
				this.removeChildAt(0)
			}
			if (!a)
			{
				addChild(target)
			}
			else
			{
				addChild(target)
			}
			
			setTimeout(function():void
				{
					if (!a)
					{
						a = true;
						
						trace(Game.Content.count)
						removeChild(target)
						//Game.Content.removeContent("domain/A.swf")
						Game.Content.clear();
						//Game.Hack.gc();
						
						trace(Game.Content.count)
						setInterval(function():void
							{
								trace(Game.Content.getMovieClipByClass("Show.FlashA"), ">>>>>>>>>>>>>>>")
							}, 2000)
							//trace(Game.Content.count)
							//Game.Content.addSwf("domain/B.swf")
					}
				}, 1000)
		}
	
	}

}